package com.isoft.service.tableservice;

import com.isoft.dao.tabledao.DfmeDlyeDao;
import com.isoft.entity.tableentity.dfme_dlye.DfmeDlyeMsg;
import com.isoft.utils.TimeFormatUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.ParseException;

@Service
@Slf4j
public class DfmeDlyeService {
    @Autowired
    DfmeDlyeDao dfmeDlyeDao;
    public  int insertmsg(DfmeDlyeMsg dfmeDlyeMsg) throws ParseException {
        Timestamp create_time = new Timestamp(System.currentTimeMillis());
        Timestamp fett= TimeFormatUtils.stringToTimestamp(dfmeDlyeMsg.getDfmeDlyeDflt().getFett());
        dfmeDlyeDao.insertMeta(create_time,dfmeDlyeMsg.getDfmeDlyeMeta());
        return dfmeDlyeDao.insertDflt(dfmeDlyeMsg.getDfmeDlyeMeta().getSeqn(),create_time,fett,dfmeDlyeMsg.getDfmeDlyeDflt());
    }
}
